package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	filePath := "E:\\1.txt"
	open, err := os.Create(filePath)
	dealWithError(err)
	_, err = fmt.Fprintf(open, "asdfzxjcklvuasodifuwqoierjaslkdfuoi")
	dealWithError(err)
	err = open.Close()
	dealWithError(err)
	file, err := os.Open(filePath)
	dealWithError(err)
	_, err = io.Copy(os.Stdout, file)
	dealWithError(err)
}

func dealWithError(err error) {
	if err != nil {
		fmt.Fprintf(os.Stderr, err.Error())
		os.Exit(1)
	}
}
